package com.ws.util;

import java.util.Arrays;

public class ArrayUtilTest {
    public static void main(String[] args) {

        int[] arr1 = new int[]{23, 45, 1, -9, 4, 2, 7};

        //获取最大值
        int max = ArrayUtil.getMax(arr1);
        System.out.println("获取最大值：" + max);

        //和值
        int sum = ArrayUtil.getSum(arr1);
        System.out.println("和值：" + sum);

        //数组反转
        ArrayUtil.reverse(arr1);
        System.out.println(Arrays.toString(arr1));

        //数组排序
        ArrayUtil.sort(arr1);
        System.out.println(Arrays.toString(arr1));

        //查找指定的元素的索引
        int index = ArrayUtil.getIndex(arr1, 5);
        System.out.println(index);

    }
}
